import { _decorator } from "cc";
import { ITEM_TYPE } from "../../../core/common/GameConst";
import BasePanel from "../../../core/component/BasePanel";
import Data from "../../../core/manager/Data";
import WXTTUtils from "../../../core/manager/WXTTUtils";
import AudioMgr from "../../../core/utils/AudioMgr";
import Utils from "../../../core/utils/Utils";
const { ccclass, property } = _decorator;

@ccclass("BuyCoinLayer")
export class BuyCoinLayer extends BasePanel {
  start() {
    this.SetText("lbl_coin", Data.user.coin + "");
  }

  onBtnClicked(event: any, customEventData: any) {
    AudioMgr.Instance().playSFX("btnclick");
    var btnName = event.target.name;
    switch (btnName) {
      case "btn_close":
        this.close();
        break;
      case "btn_ad":
        this.GetGameObject("btn_close").active = false;
        Data.user.coin += 100;
        Data.save();
        this.close();
        break;
    }
  }
}
